Add beta Bazel JVM manifest support#1312
Merged
Merged
Conversation
Martin Torp (mtorp)
approved these changes
May 15, 2026
Contributor
Martin Torp (mtorp)
left a comment
There was a problem hiding this comment.
Looks good 👏
- Remove three integration test files that depend on ~/src/bazel-bench, a local fixture not available to open-source users - Drop --json and --markdown from the manifest bazel README options since those flags are not implemented for this subcommand - Add a 10-minute timeout to bazel spawn calls to prevent CI hangs on cold-cache or stalled bazel server invocations - Cache per-attr and per-tag-key regexes at module level in bazel-build-parser to avoid recompiling on every rule block
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 28ad5cb. Configure here.
Replaces ad-hoc (e as Error).message casts and instanceof Error ternaries with getErrorCause from utils/errors.mts in three catch blocks across bazel-output-base-check, bazel-repo-discovery, and extract_bazel_to_maven.
Resolves CHANGELOG.md conflict by preserving the Unreleased Bazel entries above the 1.1.94/1.1.95/1.1.96 releases that landed on v1.x while this PR was open.
Satisfies the import-x/order lint rule by moving the ../../../utils/errors.mts import after the local ./bazel-* siblings.
Simon (simonhj)
added a commit
that referenced
this pull request
May 23, 2026
This PR makes Bazel manifest creation Python-aware. This builds on the Maven Bazel work from [#1312](#1312), which closes an inline-declaration gap that exists in `rules_jvm_external`: Bazel can resolve Maven artifacts that do not exist in a checked-in Maven manifest. Python is different. `rules_python` commonly resolves packages from a checked-in pinned requirements or lock file and exposes those packages as Bazel labels. It works like this: a Bazel Python rule points to a checked-in requirements file. Bazel reads that file and makes the declared packages available as dependencies in the configured pip hub. Future Bazel build targets can then directly declare dependencies on those Python packages. What this PR does is emit a generated `requirements.txt` that contains only the pinned Python packages reachable from Bazel Python rules. It does not mutate or remove entries from the user's checked-in requirements file. The value is scoping the generated manifest to Bazel's reached package set instead of assuming every checked-in requirement is used by Bazel Python targets. This functionality does not kick in automatically, since I'm not fully convinced it won't cause more harm than good or cause confusion. It has to be manually enabled with `socket manifest bazel --ecosystem pypi`. `socket scan create --auto-manifest` continues to generate Bazel Maven manifests only. ## Summary of changes - add `socket manifest bazel --ecosystem pypi` support for whole-repo Bazel PyPI `requirements.txt` generation - discover rules_python pip hubs via Bazel command output first, with bounded static fallback paths - keep Bazel PyPI generation explicit; `socket scan create --auto-manifest` continues to generate Bazel Maven only - add bounded verbose diagnostics for Bazel subprocess, discovery, extraction, and empty-result triage - document the new command surface and add exact constructed-fixture oracle coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds beta Bazel JVM SBOM support to Socket CLI.
Bazel is multi-language, but this PR starts with Bazel + Maven because many Bazel JVM repos declare Maven dependencies through
rules_jvm_externalinMODULE.bazelorWORKSPACEinstead of committing a manifest Socket can already scan. The extractor asks Bazel what Maven artifacts it resolved, converts that into amaven_install.json-shaped manifest, and sends it through the existing scan pipeline.What changed
socket manifest bazel [beta], a generation-only command for producing Bazel JVM SBOM manifests.socket scan create --auto-manifestso Bazel workspaces are detected automatically and scanned through the normal scan-create flow.MODULE.bazel,WORKSPACE, orWORKSPACE.bazel.@maven.jvm_importandaar_importrules frombazel query --output=build.unsorted_deps.jsonwhen available as a faster structured source..socket-auto-manifest/maven_install.jsonso we do not overwrite a repo's checked-inmaven_install.json.socket.jsondefaults, fixtures, and test coverage.User flow
Generate only:
socket manifest bazel .Generate and upload in one step:
socket scan create --auto-manifest .Testing
Tested with unit and integration coverage for:
jvm_import/aar_importparsing.unsorted_deps.jsonparsing.maven_install.json..socket-auto-manifest/output behavior.Also tested against a corpus of Bazel repositories covering constructed and real-world Maven extraction cases, Bzlmod, legacy WORKSPACE, custom repo names, pinned and unpinned lockfile flows, and scan-create auto-manifest behavior.
Local checks:
Note
Medium Risk
Adds a new Bazel-based manifest generation pipeline that shells out to
bazel/bazelisk, reads workspace outputs, and feeds generated files intoscan createtarget discovery; failures or environment differences (Java/Python/Bazel setup, permissions, timeouts) could impact scan creation behavior.Overview
Adds beta Bazel JVM SBOM support via a new
socket manifest bazelsubcommand that discoversrules_jvm_externalMaven repos (Bzlmod and legacyWORKSPACE), runs Bazel queries / readsunsorted_deps.json, and normalizes the results into amaven_install.json-shaped manifest.Extends
socket scan create --auto-manifestto detect Bazel workspaces (MODULE.bazel,WORKSPACE,WORKSPACE.bazel), generate the Bazel manifest into a sidecar directory, and include those generated files in subsequent scan file discovery.Introduces Bazel-specific hardening and plumbing (bazel binary resolution, Java/Python prerequisites,
--output_basevalidation, bounded parsers/DoS guards), plus newsocket.jsondefaults, docs/changelog updates, fixtures, and broad unit/integration test coverage.Reviewed by Cursor Bugbot for commit 28ad5cb. Configure here.